package cn.topcodes.tcsf.admin.commons;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;

public class ApplicationStartedListener implements ApplicationListener<ContextRefreshedEvent> {

    public static long startTime = -1;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if(event.getApplicationContext().getParent() != null) {
            String cost = "";
            if(startTime > -1) {
                cost = " 共耗费" + (System.currentTimeMillis() - startTime) / 1000 + "秒";
            }
            System.err.println("应用程序启动成功." + cost);
        }
    }
}